home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / utils / auxout.arc / AUXOUT.C next >
C/C++ Source or Header  |  1988-07-06  |  3KB  |  128 lines

  1. #include "d:\include\osbind.mjh"
  2.  
  3. main(argc,argv)
  4.   int argc;
  5.   char *argv[];
  6.   { int i,j,k;
  7.     char c,d;
  8.  
  9.     if (argc != 2)
  10.     { printf("\n useage: auxout [%Sn][%Cn][%Fn]<str>.[[%T<str>.|%U,<str>.|%Wc|%Dn]...]\n\n");
  11.       Pterm(0);
  12.     }
  13.  
  14.     while (Bconstat(1) != 0) Bconin(1);
  15.     while (Bconstat(2) != 0) Bconin(2);
  16.     while (*argv[1] == '%')
  17.       { argv[1]++;
  18.     switch (*argv[1])
  19.     {  case 'S':
  20.        case 's':
  21.         argv[1]++;
  22.             i = *argv[1] - '0';
  23.         if (i == 1) printf("\nSpeed: 9600  ");
  24.         if (i == 4) printf("\nSpeed: 2400  ");
  25.         if (i == 7) printf("\nSpeed: 1200  ");
  26.         Rsconf(i,-1,-1,-1,-1,-1);
  27.         Vsync(); Vsync();
  28.         argv[1]++;
  29.         break;
  30.        case 'C':
  31.        case 'c':
  32.         argv[1]++;
  33.         if (*argv[1] == '0') { i = 0x88; printf("\nConfig: 1N8"); }
  34.         if (*argv[1] == '1') { i = 0xAE; printf("\nConfig: 1E7"); }
  35.         if (*argv[1] == '2') { i = 0x8E; printf("\nConfig: 1E8"); }
  36.         Rsconf(-1,-1,i,-1,-1,-1);
  37.         Vsync(); Vsync();
  38.         argv[1]++;
  39.         break;
  40.        case 'F':
  41.        case 'f':
  42.         argv[1]++;
  43.         if (*argv[1] == '0') { i = 0x88; printf("\nNo Flow Control"); }
  44.         if (*argv[1] == '1') { i = 0xAE; printf("\n^S^Q Flow Control"); }
  45.         if (*argv[1] == '2') { i = 0x8E; printf("\nCTS/RTS Flow Control"); }
  46.         Rsconf(-1,i,-1,-1,-1,-1);
  47.         Vsync(); Vsync();
  48.         argv[1]++;
  49.         break;
  50.     }
  51.       }
  52.     printf("\nSending string...");
  53.     while (*argv[1] != '.')
  54.       { Bconout(1,(int)*argv[1]);
  55.     printf("%c",*argv[1]);
  56.         argv[1]++;
  57.       }
  58.     argv[1]++;
  59.     Bconout(1,(int)'\r');
  60.     while (*argv[1] == '%')
  61.       { argv[1]++;
  62.     switch (*argv[1])
  63.     {  case 'W':
  64.        case 'w':
  65.         argv[1]++;
  66.         c = *argv[1];
  67.         printf("\nWaiting for...%c",c);
  68.         if ((c < 0x7B) && (c > 0x60)) {c = c & 0x5F;}
  69.         while (1 == 1) 
  70.         { if (Bconstat(1) != 0)
  71.           {  d = Bconin(1) & 0x7F; 
  72.              if ((d < 0x7B) && (d > 0x60)) {d = d & 0x5F;}
  73.              if (c == d) goto alpha;
  74.           }
  75.           if (Bconstat(2) != 0)
  76.           {  d = Bconin(2);
  77.              goto beta;
  78.           }
  79.         }
  80. alpha:        argv[1]++;
  81.         for (i=k ; i<20 ; i++) { Vsync(); }
  82.         break;
  83.        case 'T':
  84.           case 't':
  85.         argv[1]++;
  86.         printf("\nSending string...");
  87.         while (*argv[1] != '.')
  88.         { c = *argv[1];
  89.           if (c == '~') c = ' ';
  90.           Bconout(1,(int)c);
  91.           printf("%c",c);
  92.           argv[1]++;
  93.         }
  94.         argv[1]++;
  95.         Bconout(1,(int)'\r');
  96.         break;
  97.        case 'U':
  98.           case 'u':
  99.         argv[1]++;
  100.         printf("\nSending string...");
  101.         while (*argv[1] != '.')
  102.         { c = *argv[1];
  103.           if (c == '~') c = ' ';
  104.           if ((c < 0x7B) && (c > 0x60)) {c = c & 0x5F;}
  105.           Bconout(1,(int)c);
  106.           printf("%c",c);
  107.           argv[1]++;
  108.         }
  109.         argv[1]++;
  110.         Bconout(1,(int)'\r');
  111.         break;
  112.        case 'D':
  113.        case 'd':
  114.         argv[1]++;
  115.         printf("\nDelay...");
  116.         i  = *argv[1] - '0';
  117.         for (j=0 ; j<=i ; j++)
  118.         { for (k=0 ; k<=30 ; k++) Vsync(); }
  119.         argv[1]++;
  120.         break;
  121.     }
  122.       }
  123.     Bconout(1,(int)'\r');
  124. beta: printf("\n");
  125.  
  126.     Pterm(0);
  127.   }
  128.